/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package persistence;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author ceu
 */
@Entity
@Table(name = "warehouse")
@NamedQueries({
    @NamedQuery(name = "Warehouse.findAll", query = "SELECT w FROM Warehouse w")})
public class Warehouse implements Serializable {
    private static final long serialVersionUID = 1L;
    
    private Integer idwarehouse;
    @Size(max = 45)
    private String name;
    @Size(max = 45)
    private String capacity;
    @Size(max = 45)
    private String dimension;
    @Size(max = 45)
    private String schedule;
    private Address address;

    public Warehouse() {
    }

    
    @TableGenerator(
        name="warehouseGen",
        table="JPA_WXS_APP_SEQUENCE_GENERATOR",
        pkColumnName="GEN_KEY",
        valueColumnName="GEN_VALUE",
        pkColumnValue="idwarehouse",
        allocationSize=1,
        initialValue=0)
        @Id
    @GeneratedValue(strategy=GenerationType.TABLE,generator="warehouseGen")
     @Column(name = "idwarehouse", nullable = false)
    public Integer getIdwarehouse() {
        return idwarehouse;
    }

    public void setIdwarehouse(Integer idwarehouse) {
        this.idwarehouse = idwarehouse;
    }

    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "capacity")
    public String getCapacity() {
        return capacity;
    }

    public void setCapacity(String capacity) {
        this.capacity = capacity;
    }

    @Column(name = "dimension")
    public String getDimension() {
        return dimension;
    }

    public void setDimension(String dimension) {
        this.dimension = dimension;
    }

    @Column(name = "schedule")
    public String getSchedule() {
        return schedule;
    }

    public void setSchedule(String schedule) {
        this.schedule = schedule;
    }

    @JoinColumn(name = "ADDRESS_idAddress", referencedColumnName = "idAddress")
    @ManyToOne(optional = false)
    public Address getADDRESSidAddress() {
        return address;
    }

    public void setADDRESSidAddress(Address aDDRESSidAddress) {
        this.address = aDDRESSidAddress;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idwarehouse != null ? idwarehouse.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Warehouse)) {
            return false;
        }
        Warehouse other = (Warehouse) object;
        if ((this.idwarehouse == null && other.idwarehouse != null) || (this.idwarehouse != null && !this.idwarehouse.equals(other.idwarehouse))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "persistence.Warehouse[ idwarehouse=" + idwarehouse + " ]";
    }
    
}
